var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var _ = require('lodash');
var sweepHandler = require('../../../app/servers/copy/handler/sweepHandler');
var copyModel = require('../../../app/models/copyModel');
var config = require('../../config');
var configUtil = require('../../../app/util/configUtil');
var analyze = require('kc-analyze');

suite('测试sweepHandler', function () {
    setup(function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id
        });
        done();
    });

    setup(function (done) {
        copyModel.getByRoleId(config.other_role_id, function (err, model) {
            model.passCopy(10101, 3);
            model.save(done);
        });
    });

    suite('sweep', function () {
        test('扫荡', function (done) {
            var msg = {};

            var session = {};
            session.uid = config.other_role_id;

            var sweep_handler = new sweepHandler();
            sweep_handler.sweep(msg, session, function (err, res) {
                done();
            });
        });

        test('扫荡', function (done) {
            var msg = {};
            msg.copy_id = 101;

            var session = {};
            session.uid = config.other_role_id;

            var sweep_handler = new sweepHandler();
            sweep_handler.sweep(msg, session, function (err, res) {
                done();
            });
        });

        test('扫荡', function (done) {
            var msg = {};
            msg.copy_id = 10101;

            var session = {};
            session.uid = config.other_role_id;

            var sweep_handler = new sweepHandler();
            sweep_handler.sweep(msg, session, function (err, res) {
                done();
            });
        });
    });
});
